<?php 
class UserPro extends CWidget{
    
    public function run()
    {
         
         $nameUser = Yii::app()->user->name;
         $IdUser = Yii::app()->db->createCommand("SELECT id FROM users WHERE username ='".$nameUser."'")->queryScalar();
         $MailUser = Yii::app()->db->createCommand("SELECT email FROM users WHERE username ='".$nameUser."'")->queryScalar();
         /** User Profiles */
         $displayName = Yii::app()->db->createCommand("SELECT display_name FROM user_profiles WHERE user_id ='".$IdUser."'")->queryScalar();
         $IdProfiles = Yii::app()->db->createCommand("SELECT id FROM user_profiles WHERE user_id ='".$IdUser."'")->queryScalar();
         $displayAvatar = Yii::app()->db->createCommand("SELECT avatar FROM user_profiles WHERE user_id ='".$IdUser."'")->queryScalar();
         
         /** Tree */
         $IdTree =Yii::app()->db->createCommand("SELECT id_tree FROM tree WHERE id_user ='".$IdUser."'")->queryScalar();
         $CountIdUser = Yii::app()->db->createCommand("SELECT COUNT(*) FROM tree WHERE id_user ='".$IdUser."'")->queryScalar();
         
         /** Total Post */
                
        $this->render('UserPro',array(
            'displayName'=>$displayName,
            'displayAvatar'=>$displayAvatar,
            'IdProfiles'=>$IdProfiles,
            'nameUser'=>$nameUser,
            'MailUser'=>$MailUser,
            'IdTree'=>$IdTree,
            'CountIdUser'=>$CountIdUser,
            
        ));
    }
}

?>